package com.liao.furns.utils;

import org.apache.commons.beanutils.BeanUtils;

import java.util.Map;

/**
 * @author lzp
 * @version 1.0
 * lzpnb!
 */
public class DataUtils {
    public static <T> T copyParamToBean(Map value , T bean ){
        try {
            BeanUtils.populate(bean, value);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bean;
    }

    public static int parseInt(String val,int defautlval){
        try {
            int i = Integer.parseInt(val);
            return i;
        } catch (NumberFormatException e) {
            System.out.println("数据格式错误");
        }
        return defautlval;
    }
}
